]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
networkAgent: Fix another ByteArray => Uint8Array instance
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 2 Aug 2018 21:54:08 +0000 (23:54 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Mon, 6 Aug 2018 12:16:59 +0000 (12:16 +0000)
This was missed in commit 7ca418a79a. As we are dealing with
non-\0-terminated data here, go through GBytes this time.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/189

js/ui/components/networkAgent.js

index 5bd648a73b6458f31fe03fcd9bc46d7848c4418e..998fcb792bf50150eb22a469e55fdae36e5f5a8c 100644 (file)
@@ -506,8 +506,12 @@ var VPNRequestHandler = new Lang.Class({
         try {
             data = this._dataStdout.peek_buffer();
 
-            keyfile.load_from_data(data.toString(), data.length,
-                                   GLib.KeyFileFlags.NONE);
+            if (data instanceof Uint8Array)
+                data = imports.byteArray.toGBytes(data);
+            else
+                data = data.toGBytes();
+
+            keyfile.load_from_bytes(data, GLib.KeyFileFlags.NONE);
 
             if (keyfile.get_integer(VPN_UI_GROUP, 'Version') != 2)
                 throw new Error('Invalid plugin keyfile version, is %d');